#! /bin/bash
export LANG=zh_CN.UTF-8
HIVE_HOME=/usr/bin/hive	

${HIVE_HOME} -S -e "
create database if not exists checkin_rpt;

drop table checkin_rpt.rpt_student_checkin;
create table checkin_rpt.rpt_student_checkin(
--维度
class_id int,
class_date string,
yearinfo string,
monthinfo string,
dayinfo string,
morning_ontime_count   bigint,
afternoon_ontime_count bigint,
evening_ontime_count   bigint,
morning_ontime_ratio   decimal(5,2),
afternoon_ontime_ratio decimal(5,2),
evening_ontime_ratio   decimal(5,2),
morning_late_count bigint,
afternoon_late_count bigint,
evening_late_count bigint,
morning_late_ratio   decimal(5,2),
afternoon_late_ratio decimal(5,2),
evening_late_ratio   decimal(5,2),
morning_leave_count bigint,
afternoon_leave_count bigint,
evening_leave_count bigint,
morning_leave_ratio decimal(5,2),
afternoon_leave_ratio decimal(5,2),
evening_leave_ratio decimal(5,2),
morning_absent_count bigint,
afternoon_absent_count bigint,
evening_absent_count bigint,
morning_absent_ratio decimal(5,2),
afternoon_absent_ratio decimal(5,2),
evening_absent_ratio decimal(5,2)
)comment '学生考勤表'
row format delimited fields terminated by '\t'
stored as orc
tblproperties ('orc.compress' = 'SNAPPY');
"